Easy2Siksha.com
A Binary Tree is a hierarchical data structure in which each node can have at most two
children, called the left child and the right child. It organizes data efficiently, making
searching, inserting, and deleting information easier than in many linear structures. In
memory, a binary tree is implemented using nodes, where each node contains data, a left
pointer, and a right pointer that store the addresses of its child nodes. To access every node
in a binary tree, different traversal techniques are used. The three main traversal methods
are Preorder (Root → Left → Right), Inorder (Left → Root → Right), and Postorder (Left →
Right → Root). Each traversal follows a unique visiting order and is useful for different
applications, such as expression evaluation, sorted data retrieval, and deleting tree
structures. Understanding binary trees and their traversal methods forms the foundation for
learning advanced data structures and algorithms.
6. What is Graph? How is it represented in the memory? Explain Breadth-First Search
method to traverse a node of a Graph using suitable example.
Ans: A Graph is a non-linear data structure that is used to represent relationships between
different objects. In simple words, think of a graph as a map of connected points. These
points are called vertices (or nodes), and the lines connecting them are called edges.
For example, imagine you and your friends are connected on a social media platform. Every
person is a node, and every friendship is an edge connecting two people. This forms a
graph. Similarly, Google Maps, Facebook, computer networks, and airline routes all use
graphs.
Basic Components of a Graph
There are two main parts of a graph:
1. Vertex (Node): Represents an object or point.
2. Edge: Represents the connection between two vertices.
For example, consider the following graph:
A
/ \
B C
/ \ \
D E F
Here:
• Vertices = A, B, C, D, E, F
• Edges = A-B, A-C, B-D, B-E, C-F